package com.yesjpt.dao;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.*;

import com.yesjpt.domain.Notice;

@Mapper
public interface NoticeDao {
	//根据ID查询，注解，当不麻烦的时候采用这个办法
	@Select("select * from t_notice t where t.id = #{id}")
	Notice findById(String id);

	//根据ID删除
	@Delete("delete from t_notice where id = #{id}")
	int delete(String id);
	
	//更新，在Mapper.xml中实现
	int update(Notice vo);
	
	//新增，直接实现
	@Insert("insert into t_notice(id, title, content, status, creatorId) values(#{id}, #{title}, #{content}, #{status}, #{creatorId})")
	int add(Notice vo);

	//查询符合条件的个数，注意params
	Long count(@Param("params") Map<String, Object> params);
	
	//分页查询，注意params，offset，limit
	List<Notice> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset,	@Param("limit") Integer limit);

	//根据参数查询，注意params
	List<Notice> listByParams(@Param("params") Map<String, Object> params);
}
